Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add trace #999

Merged
merged 9 commits into from
Jun 16, 2023
Merged

feat(cli): add trace #999

merged 9 commits into from
Jun 16, 2023

Conversation

dk1a
Copy link
Contributor

@dk1a dk1a commented Jun 7, 2023

fixes #713
also updates pnpm (this wasn't very intentional, do u want it in a separate PR? ) (moved this to #1000)
and refactors existingContracts a bit, since it was gathering a lot of code repetition with trace also using it

@holic
Copy link
Member

holic commented Jun 7, 2023

also updates pnpm (this wasn't very intentional, do u want it in a separate PR? )

yeah if it's not needed for this PR, it'd be great to remove this or separate it

@dk1a dk1a marked this pull request as ready for review June 7, 2023 19:08
@dk1a dk1a requested review from alvrs and holic as code owners June 7, 2023 19:08

const labels: { name: string; address: string }[] = [];
for (const name of names) {
const tableId = new TableId(namespace, name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to this PR but we should probably rename this util from TableId to ResourceSelector

Comment on lines 1 to 15
import { existsSync, readFileSync } from "fs";
import type { CommandModule } from "yargs";
import { ethers } from "ethers";

import { loadConfig } from "@latticexyz/config/node";
import { MUDError } from "@latticexyz/common/errors";
import { cast, getRpcUrl, getSrcDirectory } from "@latticexyz/common/foundry";
import { TableId } from "@latticexyz/utils";
import { StoreConfig } from "@latticexyz/store";
import { resolveWorldConfig, WorldConfig } from "@latticexyz/world";
import { IBaseWorld } from "@latticexyz/world/types/ethers-contracts/IBaseWorld";
import { getChainId, getExistingContracts } from "../utils";

import IBaseWorldData from "@latticexyz/world/abi/IBaseWorld.sol/IBaseWorld.json" assert { type: "json" };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing was supposed to mirror deploy.ts, but then I added some deps and forgot em. wdyt now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure why spacing is like this in deploy.ts either haha, if we put spacing between imports i'd expect to have a group for external dependencies, maybe a separate one for mud dependencies, and maybe a third one for local imports. So in this case i'd expect the IBaseWorldData import to be in the same group as the other mud imports, and then maybe a space between that group and ../utils, but no strong opinion about that.

@dk1a dk1a requested a review from alvrs June 8, 2023 13:38
Comment on lines 76 to 78
const tableId = new TableId(namespace, name);
// Get the first field of `Systems` table (the table maps system name to its address and other data)
const address = await WorldContract.getField(systemsTableId.toHexString(), [tableId.toHexString()], 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TableId class should probably be called ResourceSelector, but even without that change we shouldn't call the variable tableId here to avoid confusion

Suggested change
const tableId = new TableId(namespace, name);
// Get the first field of `Systems` table (the table maps system name to its address and other data)
const address = await WorldContract.getField(systemsTableId.toHexString(), [tableId.toHexString()], 0);
const systemSelector = new TableId(namespace, name);
// Get the first field of `Systems` table (the table maps system name to its address and other data)
const address = await WorldContract.getField(systemsTableId.toHexString(), [systemSelector.toHexString()], 0);

@changeset-bot
Copy link

changeset-bot bot commented Jun 16, 2023

⚠️ No Changeset found

Latest commit: 90d8d89

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CLI] Wrapper around cast run to load contract source and ABI
3 participants